Copyright (c) Intel Corporation, 2007 - 2021  All Rights Reserved.

Intel(R) Active Management Technology (Intel AMT):
A brief overview of the SDK's C++ WS-Management Developer's Package 

Introduction:
-------------
The C++ WS-Management Developer's Package is intended to provide a foundation 
for developing WS-Management client applications in C++. While the package was 
created with Intel(R) AMT in mind, it is intended to provide a general solution
for communicating with any WS-Management server.

The project includes:

-  The WsmanClient.h interface class defines a general API for WS-Management
   communication. This includes the basic WS-Management routines Create, Get, 
   Put, Delete, Invoke and Enumerate. We offer no fewer than three different
   implementations of this interface based on OpenWSMAN, gSoap and Microsoft
   WinRM*, each with its advantages and disadvantages.

-  The XML utility header files XMLTypes.h and XMLUtils.h provide the tools
   for serializing and deserializing the auto generated CIM classes.
   XMLTypes.h includes the definitions of several basic types used in the
   CIM classes as well as a utility class for converting between XML strings
   and basic CIM types. XMLUtils.h defines the XMLElement and XMLDoc
   interfaces for writing and parsing XML data. 

Below are more detailed descriptions of the different components.

The zip includes:
	1) Bin folder: compiled dlls and libs, 32-bit and 
      	   64-bit files: 
		*CimOpenWsmanClient.lib 
		*CimWinRMClient.lib
		*CPPCimFramework.dll
		*CPPCimFramework.lib
		*CPPCimFrameworkUntyped.dll
		*CPPCimFrameworkUntyped.lib

	2) Src folder: 
		a) C++ source code for the dlls\libs included in this package.
		b) OpenWsman and Libxml2 sources and libs


How to Build:
-------------

a) Using provided .bat file 

   1. Download latest version of CMAKE, from https://cmake.org/download/ 
      Place the CMAKE content under Src\Tools\cmake folder.
   2. Run Build_WS-ManagementCPP.bat, located under the Src\WS-Management 
      folder.

b) Interactive build:

   1. Run Visual Studio 2019. 
   2. Navigate to: File -> Open -> CMake 
   3. Select the specific CMakeLists.txt for the project you want to build.


OpenWsmanClient:
----------------
The OpenWsmanClient is a multiplatform (Windows and Linux) WS-Management client
based on the open source project OpenWSMAN (see http://www.openwsman.org/),
which is available under a BSD license. The OpenWSMAN lib supports server and
mutual authentication (remote and local) and hence provides a complete
solution for communicating WS-Management in both Linux and Windows with 
WS-Management servers such as Intel AMT. The HTTP layer of the WS-Management 
Communication is handled using CurlLib (MIT license) for Linux and winhttp for 
Windows. The library also uses the open source libxml library (MIT license). 
Below are instructions for compiling the OpenWSMAN library. 
(Note that the package includes precompiled Windows Release and Debug libraries
in the Openwsman folder). To use the OpenWsmanClient WS-Management client
include the generated library as well as the OpenWsmanClient.h file.

The Package includes OpenWsman compiled binaries, you may also compile OpenWsman 
on your own using Visual Studio (OpenWsmanLib.vcproj).


SoapWsmanClient (gSOAP):
-----------------------
The SoapWsmanClient is a multiplatform (Windows and Linux) WS-Management client
based on gSOAP. Call makewsdl.bat to generate C++ files from the xsd and wsdl 
definitions in the Include->Wsdls directory. 
These define the general structure of the basic WS-Management routines. The 
input and output of these routines are handled as dom (xml) elements by gSOAP 
(in a manner such that the gSOAP routines are unaware of the CIM objects that
they are handling). The SoapWsmanClient receives a soap struct pointer in
its constructor, so that the user is free to define all aspects of the
soap communication before passing the soap struct to the client.

Download gSOAP from https://sourceforge.net/projects/gsoap2/

These 2 .exe files located in gsoap\bin are needed for compilation:
 * wsdl2h.exe
 * soapcpp2.exe
Update GSOAP_PATH variable in makewsdl.bat to be the path to these .exe files.


WRMWsmanClient:
---------------
The WinRM based WS-Management client is intended for WinRM enabled Windows
platforms (see the MSDN website for an updated list). To use this client
you must first configure WinRM from the command shell (e.g. add the
target IP address to the list of trusted hosts and "set WinRM/config
@{AllowUnencrypted="true"}"). See the WinRM help for details. The
WRMWsmanClient implementation uses COM objects. This means that the
function CoInitilaize must be invoked (once) at the beginning of the
client application, and CoUninitialize at the its end. Note that to date
the WRMWsmanClient does not support the option of passing an
EndpointReference as a Selector (as it is unclear whether this option is
supported by WinRM).

Please find more details in the WinRM_CPP Readme, located under: 
Src\WS-Management\CimWinRMClient


Error Handling:
---------------
In the Exception.h file, a GeneralWsmanException (extends std::exception)
class is defined as a base class for all of the exceptions defined in the
many components of the project (WsmanClientException, CIMXmlException and
CimClassException). The exception classes contain error messages as well as
as an error code from the list of error codes defined in Exception.h.

-------------------------------------------------------------------
 * Other names and brands may be claimed as the property of others.
